<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ include file="../config/config.jsp"%>
<!DOCTYPE html>
<html>
<head>
<title></title>
<meta charset="UTF-8">
<link rel="stylesheet" href="<%=basePath %>css/bootstrap.min.css" media="screen"/>
<link rel="stylesheet" href="<%=basePath %>css/bootstrap-datetimepicker.min.css" media="screen"/>
<link rel="stylesheet" href="<%=basePath %>css/bootstrap-theme.min.css" />

<script src="<%=basePath %>js/jquery-3.2.1.min.js"></script>
<script src="<%=basePath %>js/bootstrap.min.js"></script>
<script src="<%=basePath %>js/bootstrap-datetimepicker.js"></script>
<script src="<%=basePath %>js/locales/bootstrap-datetimepicker.zh-CN.js"></script>

<style type="text/css">
body {
	padding-bottom: 40px;
}

.sidebar-nav {
	padding: 9px 0;
}

@media ( max-width : 980px) {
	/* Enable use of floated navbar text */
	.navbar-text.pull-right {
		float: none;
		padding-left: 5px;
		padding-right: 5px;
	}
}

.table tr td {
	border: 1px solid transparent !important;
}

.form-control {
	width: 14%;
}
</style>
</head>
<body>
	<form action="<%=basePath %>/movieServlet?method=update" method="post"
		enctype="multipart/form-data">
		<table class="table table-condensed">
			<tr>
				<td width="6%" style="line-height: 32px;">电影编号</td>
				<td width="40%"><input type="text" name="movieId"
					value="${movie.movieId}" class="form-control" style="width: 270px;"
					readonly /></td>
				<td style="line-height: 32px; width: 6%">电影名称</td>
				<td width="40%"><input type="text" name="movieName"
					value="${movie.movieName }" class="form-control"
					style="width: 270px;" required /></td>
			</tr>
			<tr>
				<td width="6%" style="line-height: 32px;">影片主演</td>
				<td width="40%"><input type="text" name="starring"
					value="${movie.starring }" class="form-control"
					style="width: 270px;" required /></td>
				<td style="line-height: 32px; width: 6%">影片详情</td>
				<td><input type="text" name="detail" value="${movie.detail }"
					class="form-control" style="width: 270px;" required /></td>
			</tr>
			<tr>
				<td width="6%" style="line-height: 32px;">电影时长</td>
				<td width="40%"><input type="text" name="duration"
					value="${movie.duration }" class="form-control"
					style="width: 270px;" required /></td>
				<td style="line-height: 32px; width: 6%">电影导演</td>
				<td><input type="text" name="director"
					value="${movie.director }" class="form-control"
					style="width: 270px;" required /></td>
			</tr>
			<tr>
				<td width="6%" style="line-height: 32px;">电影语言</td>
				<td width="40%"><select name="language" id="language"
					style="width: 270px;" class="selectpicker show-tick form-control"
					data-live-search="false">
						<option value="英语">英语</option>
						<option value="普通话">普通话</option>
						<option value="粤语">粤语</option>
						<option value="印度语">印度语</option>
						<option value="韩语">韩语</option>
						<option value="日语">日语</option>
						<option value="法语">法语</option>
						<option value="西班牙语">西班牙语</option>
				</select></td>
				<td width="6%" style="line-height: 32px;">电影类型</td>
				<td width="40%"><select name="movieType" id="movieType"
					style="width: 270px;" class="selectpicker show-tick form-control"
					data-live-search="false">
						<option value="科技">科技</option>
						<option value="喜剧">喜剧</option>
						<option value="冒险">冒险</option>
						<option value="记录">记录</option>
						<option value="奇幻">奇幻</option>
						<option value="战争">战争</option>
						<option value="爱情">爱情</option>
						<option value="悬疑">悬疑</option>
						<option value="动作">动作</option>
						<option value="亲情">亲情</option>
						<option value="动画">动画</option>
						<option value="犯罪">犯罪</option>
				</select></td>
			</tr>
			<tr>
				<td width="6%" style="line-height: 32px;">口号</td>
				<td width="40%"><input type="text" name="slogan"
					value="${movie.slogan }" class="form-control" style="width: 270px;"
					required /></td>
				<td style="line-height: 32px; width: 6%">海报图片</td>
				<td><input type="file" name="poster" value="${movie.poster }"
					class="form-control" style="width: 270px;" required /></td>
			</tr>
			<tr>
				<td width="6%" style="line-height: 32px;">男主图片</td>
				<td width="40%"><input type="file" id="manActorPic"
					name="manActorPic" class="form-control" style="width: 270px;"
					required /></td>
				<td style="line-height: 32px; width: 6%">女主图片</td>
				<td><input type="file" name="womanActorPic"
					value="${movie.womanActorPic }" class="form-control"
					style="width: 270px;" required /></td>
			</tr>
			<tr>
				<td width="6%" style="line-height: 32px;">上映时间</td>
				<td width="40%">
					<div class="input-group date form_datetime col-md-5"  data-date-format="yyyy-mm-dd hh:ii:ss" style="width:270px;" data-link-field="dtp_input1">
	                    <input class="form-control" size="15" type="text" value="${movie.releaseTime }" name="releaseTime" required readonly>
	                    <span class="input-group-addon"><span class="glyphicon glyphicon-remove"></span></span>
						<span class="input-group-addon"><span class="glyphicon glyphicon-th"></span></span>
	                </div>
	                <input type="hidden" id="dtp_input1" value="" />
				</td>
				<td width="6%" style="line-height: 32px;">电影状态</td>
				<td><select name="movieStat" id="movieStat"
					class="selectpicker show-tick form-control" style="width: 270px;"
					data-live-search="false">
						<option value="1">正在热映</option>
						<option value="2">即将上映</option>
						<option value="3">已经放映</option>
				</select></td>
			</tr>
			<tr>
				<td colspan="3"></td>
				<td>
					<button type="submit" class="btn btn-primary">保 存</button>&nbsp;&nbsp;
					<button type="button" class="btn btn-success" name="backid"
						id="backid">返 回</button>
				</td>
			</tr>
		</table>
	</form>
</body>
<script>
	var newDate = new Date();
	var t = newDate.toJSON(); 
	$('.form_datetime').datetimepicker({
	    language:  'zh-CN',
	    weekStart: 1,
	    todayBtn:  1,
		autoclose: 1,
		todayHighlight: 1,
		startView: 2,
		forceParse: 0,
	    showMeridian: 1,
	    startDate:new Date(t)
	});
	
    $(function () {   
    	// 回显语言类型下拉框数据
    	var languageName = "${movie.language }";
    	$("#language option").each(function(){ //遍历全部option
    		var txt = $(this).text(); //获取option的内容
    		if(txt == languageName) {
    			$(this).attr("selected",true);
    		}
   	    });
    	
    	// 回显电影类型下拉框数据
    	var movieTypeName = "${movie.movieType }";
    	$("#movieType option").each(function(){ //遍历全部option
    		var txt = $(this).text(); //获取option的内容
    		if(txt == movieTypeName) {
    			$(this).attr("selected",true);
    		}
   	    });    
    	
    	// 回显电影状态下拉框数据
    	 var movieStatName="${movie.movieStat }";
   		 $("#movieStat option").each(function(){ //遍历全部option
	  		var txt = $(this).val(); //获取option的value
	  		if(txt == movieStatName) {
	  			$(this).attr("selected",true);
	  		}
  	    });  
    	
    	// 点击返回
		$('#backid').click(function(){
				window.location.href="Movie/index.jsp";
		 });

    });
</script>
</html>